package org.wxd.mis.reg.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.wxd.mis.reg.api.ServiceRegistry;
import org.wxd.mis.reg.api.ServiceRegistryImpl;

/**
 * 获取registry配置项的信息，即zk的地址
 * Created by wangxd on 2017/3/15.
 */
@Configuration
@ConfigurationProperties(prefix = "registry")
public class RegistryConfig {
    private String servers;

    @Bean
    public ServiceRegistry serviceRegistry(){
        return new ServiceRegistryImpl(servers);
    }

    public void setServers(String servers){
        this.servers = servers;
    }

}
